<!DOCTYPE html PUBLIC "-//W3C//DTD//XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>CSSOM - CSSStyleRule - Instance</title>
    <link rel="author" title="Glenn Adams" href="mailto:glenn@skynav.com"/>
    <link rel="help" href="http://www.w3.org/TR/cssom/#the-cssstylerule-interface"/>
    <meta name="flags" content="dom"/>
    <script src="/resources/testharness.js"/>
    <script src="/resources/testharnessreport.js"/>
    <style id="sheet">
      * {
      }
    </style>
  </head>
  <body>
    <div id="log"></div>
    <div id="box"></div>
    <script><![CDATA[

      var doc = window.document;

      test(function(){

        assert_true('styleSheets' in doc);

      }, '\'styleSheets\' in doc');

      var sheets = doc.styleSheets;

      test(function(){

        assert_true(sheets.length > 0);

      }, 'doc.styleSheets.length > 0');

      var sheet = doc.styleSheets[0];

      test(function(){

        assert_true(sheet instanceof CSSStyleSheet);

      }, 'doc.styleSheets[0] instanceof CSSStyleSheet');

      test(function(){

        assert_true('cssRules' in sheet);

      }, '\'cssRules\' in doc.styleSheets[0]');

      var rules = sheet.cssRules;

      test(function(){

        assert_true(rules instanceof CSSRuleList);

      }, 'doc.styleSheets[0].cssRules instanceof CSSRuleList');

      test(function(){

        assert_true(rules.length > 0);

      }, 'doc.styleSheets[0].cssRules.length > 0');

      var rule = rules[0];

      test(function(){

        assert_true(rule instanceof CSSRule);

      }, 'doc.styleSheets[0].cssRules[0] instanceof CSSRule');

      test(function(){

        assert_true(rule instanceof CSSStyleRule);

      }, 'doc.styleSheets[0].cssRules[0] instanceof CSSStyleRule');

      test(function(){

        assert_equals(rule.toString(), '[object CSSStyleRule]');

      }, 'doc.styleSheets[0].cssRules[0].toString() == \'[object CSSStyleRule]\'');

      test(function(){

        assert_true('type' in rule);

      }, '\'type\' in doc.styleSheets[0].cssRules[0]');

      test(function(){

        assert_equals(rule.type, 1);

      }, 'doc.styleSheets[0].cssRules[0].type == 1');

      test(function(){

        assert_true('cssText' in rule);

      }, '\'cssText\' in doc.styleSheets[0].cssRules[0]');

      test(function(){

        assert_equals(rule.cssText, '* { }');

      }, 'doc.styleSheets[0].cssRules[0].cssText == \'* { }\'');

      test(function(){

        assert_true('parentRule' in rule);

      }, '\'parentRule\' in doc.styleSheets[0].cssRules[0]');

      test(function(){

        assert_true(rule.parentRule === null);

      }, 'doc.styleSheets[0].cssRules[0].parentRule === null');

      test(function(){

        assert_true('parentStyleSheet' in rule);

      }, '\'parentStyleSheet\' in doc.styleSheets[0].cssRules[0]');

      test(function(){

        assert_true(rule.parentStyleSheet === sheet);

      }, 'doc.styleSheets[0].cssRules[0].parentStyleSheet === doc.styleSheets[0]');

      test(function(){

        assert_true('selectorText' in rule);

      }, '\'selectorText\' in doc.styleSheets[0].cssRules[0]');

      test(function(){

        assert_equals(typeof(rule.selectorText), 'string');

      }, 'typeof(doc.styleSheets[0].cssRules[0].selectorText) == \'string\'');

      test(function(){

        assert_equals(rule.selectorText, '*');

      }, 'doc.styleSheets[0].cssRules[0].selectorText == \'*\'');

      test(function(){

        assert_true('style' in rule);

      }, '\'style\' in doc.styleSheets[0].cssRules[0]');

      var style = rule.style;

      test(function(){

        assert_true(style instanceof CSSStyleDeclaration);

      }, 'doc.styleSheets[0].cssRules[0].style instanceof CSSStyleDeclaration');

      test(function(){

        assert_equals(style.length, 0);

      }, 'doc.styleSheets[0].cssRules[0].style.length == 0');

      test(function(){

        assert_equals(style.cssText, '');

      }, 'doc.styleSheets[0].cssRules[0].style.cssText == \'\'');

    ]]>
    </script>
  </body>
</html>
